package utils

import (
	"bytes"
	"gogo/log"
	"os"
	"os/exec"
)

func (c *GoGo_Utils_Class) CmdRun(name string, args ...string) string {
	cmd := exec.Command(name, args...)
	cmd.Env = os.Environ()
	var outputbuf1 bytes.Buffer
	cmd.Stdout = &outputbuf1 //设置输入
	if err := cmd.Run(); err != nil {
		log.This().ErrorF("failed to run command: %s\n", err)
		return ""
	}
	//log.This().DebugF("cmd suss: %s %v\n", name, args)
	return outputbuf1.String()
}
